package com.twu.biblioteca;

import java.util.LinkedList;
import java.util.List;

class BookManager {

    private BookRepository bookRepository;

    private final List<Book> reservations = new LinkedList<>();

    BookManager(BookRepository bookRepository) {
        this.bookRepository = bookRepository;
    }

    boolean reserveBook(Book book) {
        boolean result = bookRepository.findAll().contains(book)
                && reservations.contains(book) == false;
        if (result == true) {
            reservations.add(book);
        }
        return result;
    }

}
